<template>
  <section class="container">
    <div class="box" v-loading="loading">
      <div class="title">{{ title }}<i class="el-icon-close"></i></div>
      <div class="content">{{ content }}</div>
    </div>
  </section>
</template>

<script>
import { isRealName } from "../../request/api";
export default {
  // 组件名称
  name: "authentication",
  props: {
    // 身份证号码
    cardNo: {
      type: Number,
      default: "",
    },
    // 手机号码
    phone: {
      type: Number,
      default: "",
    },
    // 身份证号码
    userName: {
      type: String,
      default: "",
    },
  },
  // 组件状态值
  data() {
    return {
      loading: true,
      title: "认证中",
      content: "认证失败",
    };
  },
  components: {},
  // 计算属性
  computed: {},
  // 组件方法
  methods: {
    init() {
      let { cardNo, phone, userName } = this;
      isRealName({
        cardNo,
        phone,
        userName,
      })
        .then((res) => {})
        .catch((err) => {
          this.loading = false;
        });
    },
  },
  mounted() {
    this.init();
  },
};
</script>
<!-- Add "scoped" attribute to limit CSS to this component only -->
<style lang="less" scoped>
.container {
  width: 100%;
  height: 100%;
  position: fixed;
  z-index: 999;
  left: 0;
  top: 0;
  background: rgba(0, 0, 0, 0.3);
  display: flex;
  justify-content: center;
  align-items: center;
  .box {
    width: 430px;
    height: 450px;
    padding: 50px 0 70px;
    background: #fff;
    position: relative;
    .title {
      width: 100%;
      height: 50px;
      display: flex;
      justify-content: center;
      align-items: center;
      position: absolute;
      top: 0;
      left: 0;
      font-size: 20px;
      i {
        position: absolute;
        font-size: 25px;
        right: 10px;
        top: 50%;
        cursor: pointer;
        transform: translateY(-50%);
      }
    }
    .content {
      width: 100%;
      height: 100%;
      display: flex;
      justify-content: center;
      align-items: center;
      font-size: 18px;
    }
  }
}
</style>
